package com.dingyang.controller;

import com.dingyang.controller.base.BaseController;
import com.dingyang.entity.ApprovalDocuments;
import com.dingyang.service.ApprovalDocumentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;

/**
 * @Author 晚点再动心
 * @Date 2022/8/30
 */
@RestController
@RequestMapping("/approval_documents")
public class ApprovalDocumentsController extends BaseController<ApprovalDocuments, ApprovalDocumentsService> {

    /**
     *审批文件对象
     */
    @Autowired
    public ApprovalDocumentsController(ApprovalDocumentsService service) {
        setService(service);
    }

    @PostMapping("/add")
    @Transactional
    public Map<String, Object> add(HttpServletRequest request) throws IOException {
        Map<String,Object> paramMap = service.readBody(request.getReader());
        this.addMap(paramMap);
        return success(1);
    }

}
